package experiment;

import java.util.ArrayList;

public class Question {
	private int ID;
	private String question;
	private ArrayList<String> answers;
	private String rightAnswer;
	private QuestionType questionType;
	private int answerIndex;
	
	public Question(int ID, String question, ArrayList<String> answers, int answerIndex, String questionType)
	{
		this.ID = ID;
		this.setQuestion(question);
		this.setAnswers(answers);
		this.setAnswerIndex(answerIndex);
		this.rightAnswer = answers.get(answerIndex);
		
		if(questionType.equals("T1"))
		{
			this.questionType = QuestionType.T1;
		}
		else if(questionType.equals("T2"))
		{
			this.questionType = QuestionType.T2;
		}
		else if(questionType.equals("T3"))
		{
			this.questionType = QuestionType.T3;
		}
		else if(questionType.equals("T4"))
		{
			this.questionType = QuestionType.T4;
		}
	}
	
	public boolean isAnswerRight(String answer)
	{
		return rightAnswer.equals(answer);	
	}

	public ArrayList<String> getAnswers() {
		return answers;
	}

	private void setAnswers(ArrayList<String> answers) {
		this.answers = answers;
	}

	public String getQuestion() {
		return question;
	}

	private void setQuestion(String question) {
		this.question = question;
	}
	
	public QuestionType getQuestionType() {
		return questionType;
	}

	public void setQuestionType(QuestionType questionType) {
		this.questionType = questionType;
	}

	enum QuestionType
	{
		T1, T2, T3, T4;
	}

	public int getId() {
		// TODO Auto-generated method stub
		return this.ID;
	}
	
	public String toString()
	{
		return this.getId() + ";" + this.getQuestion() + ";" + this.answers;
	}

	public int getAnswerIndex() {
		return answerIndex;
	}

	public void setAnswerIndex(int answerIndex) {
		this.answerIndex = answerIndex;
	}
}
